"""
1.鼠标和键盘操作.py
#from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver import ActionChains
常用的鼠标动作:
1. 右击  context_click()
2. 双击  double_click()
3. 悬停 move_to_element()


"""
from time import sleep

from selenium import webdriver
#from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver import ActionChains
from selenium.webdriver.common.by import By

driver = webdriver.Chrome()
# sleep(2)
# driver.minimize_window()
sleep(2)
driver.maximize_window()
sleep(2)
# driver.set_window_size(500,700)
# sleep(2)
# driver.maximize_window()
# sleep(2)
driver.get("http://www.baidu.com")
sleep(2)
# t = driver.find_element(By.ID,"kw")
# #动作链表示可以连续执行的动作,每个动作用 '.'进行连接,最后使用perform()进行结尾
# ActionChains(driver).send_keys_to_element(t,"周慧敏").double_click().context_click().perform()
# sleep(2)
t = driver.find_element(By.CSS_SELECTOR,"#s-usersetting-top")
# 重点掌握鼠标悬停
ActionChains(driver).move_to_element(t).perform()
sleep(5)

driver.quit()